package entity

import (
	"core/datetime"
)

type CommPort struct {
	Id int64 `json:"id,string"                         gorm:"column:id;primaryKey;autoIncrement:false;comment:主键;"`

	Name string `json:"name"      validate:"required,max=50"   gorm:"column:name;size:50;DEFAULT:'';not null;comment:名称;"`

	CommType string `json:"commType"      validate:"max=50"   gorm:"column:comm_type;size:50;DEFAULT:'';not null;comment:协议类型;"` //TCP UDP HTTP

	Port int32 `json:"port"      validate:""   gorm:"column:port;DEFAULT:60000;not null;comment:端口;"`

	Timeout     int32 `json:"timeout"      validate:""   gorm:"column:timeout;DEFAULT:60;not null;comment:TCP超时;"`
	ReadBuffer  int32 `json:"readBuffer"      validate:""   gorm:"column:read_buffer;DEFAULT:1024;not null;comment:ReadBuffer;"`
	WriteBuffer int32 `json:"writeBuffer"      validate:""   gorm:"column:write_buffer;DEFAULT:1024;not null;comment:WriteBuffer;"`

	LogicTimeOut int32 `json:"logicTimeOut"                         gorm:"column:logic_time_out;DEFAULT:120;comment:逻辑离线时间;"`
	KeepAlive    bool  `json:"keepAlive"                         gorm:"column:keep_alive;type:tinyint(1);comment:是否长连接;"`
	//Special      bool  `json:"special"      validate:""   gorm:"column:special;DEFAULT:false;type:tinyint(1);not null;comment:是否通用;"`

	Memo      string `json:"memo"                             gorm:"column:memo;size:2000;DEFAULT:'';not null;comment:备注;"`
	ProxyMode string `json:"proxyMode"                             gorm:"column:proxy_mode;size:50;DEFAULT:'';not null;comment:代理模式;"`

	Deleted datetime.DeletedAt `json:"deleted"                          gorm:"column:deleted;DEFAULT:0;type:tinyint(1);not null;comment:删除标志;"`
}

func (p *CommPort) TableName() string {
	return "CommPort"
}

